﻿using ChinaUnicom.ViewModels;
using Microsoft.Phone.Controls;
using System;
using System.Windows;
using System.Windows.Navigation;

namespace ChinaUnicom.Views
{
    public partial class FeeHistoryPage : PhoneApplicationPage
    {
        public FeeHistoryPage()
        {
            InitializeComponent();

            Loaded += OnPageLoaded;
        }

        void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            if (NavigationContext.QueryString.ContainsKey("year") && NavigationContext.QueryString.ContainsKey("month"))
            {
                int year = int.Parse(NavigationContext.QueryString["year"]);
                int month = int.Parse(NavigationContext.QueryString["month"]);
                DataContext = new FeeHistoryContext(year, month);
            }
        }

        private void OnBackClick(object sender, EventArgs e)
        {
            NavigationService.GoBack();
        }
    }
}